package com.nimt.hqgl_idea.controller;

import com.nimt.hqgl_idea.entity.Merchant;
import com.nimt.hqgl_idea.param.MerchantParam;
import com.nimt.hqgl_idea.service.MerchantService;
import com.nimt.hqgl_idea.util.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/merchant")
public class MerchantController {
    @Autowired
    MerchantService merchantService;

    @GetMapping("/query")
    public ResponseBody query(MerchantParam merchantParam){
        return merchantService.query(merchantParam);
    }

    @PostMapping("/state")
    public ResponseBody state(Merchant merchant){
        return merchantService.state(merchant);
    }

    @PutMapping("/updateMerchant")
    public ResponseBody updateMerchant(Merchant merchant){
        return merchantService.updateMerchant(merchant);
    }

    @PostMapping("/del")
    public ResponseBody del(Integer id){
        return merchantService.del(id);
    }

    @PostMapping("/add")
    public ResponseBody add(Merchant merchant){
        return merchantService.add(merchant);
    }
}
